package com.reggie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.reggie.common.BaseContext;
import com.reggie.entity.ShoppingCart;
import com.reggie.service.ShoppingCartService;
import com.reggie.mapper.ShoppingCartMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 78664
 * @description 针对表【shopping_cart(购物车)】的数据库操作Service实现
 * @createDate 2022-09-08 21:29:10
 */
@Service
public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart>
        implements ShoppingCartService {

    @Resource
    private ShoppingCartService shoppingCartService;

    @Override
    public void clean() {
        LambdaQueryWrapper<ShoppingCart> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ShoppingCart::getUserId, BaseContext.getCurrentUserId());
        shoppingCartService.remove(queryWrapper);
    }
}




